{include file="top.html"}
<link rel="stylesheet" href="{$CSS_PATH}detail.css"/>
<script type="text/javascript" src="{$JS_PATH}jquery.cookie.js"></script>

<div class="wrapper clearfix">
  <div class="container">
    <div class="detail">
        <div class="detail-left">
           <img src="{$goods.goods_img}"  alt="" title=""/>
        </div>
        <div class="detail-right">
            <h1 class="pro-title ">{$goods.goods_name}</h1>
            <div class="clearfix ">
                <span class="feture-item" data-summary="学习规划一目了然，学习、练习、测试高度结合、完整的教学过程带来更好的学习效果！" data-feature="null" original-title="">系统化学习</span>
                <span class="feture-item" data-summary="课后作业专人批改，学习效果全掌握！" data-feature="null" original-title="">作业批改</span>
                <span class="feture-item" data-summary="课后作业专人批改，学习效果全掌握！" data-feature="null" original-title="">  在线一对一  </span>
                 <span class="feture-item" data-summary="提供独家学习资料或内部讲义下载，辅助课程学习，达成最终学习目标！" data-feature="null" original-title="">名师答疑</span>

            </div>
            <div class="clearfix detail-price">
                <p>
                    <input id="shop-price" type="hidden" value="{$goods.shop_price}"/>
                    <span class="class-price-unit">￥</span><span class="class-price" id="sum-price">{$goods.shop_price}</span> <!--<span class="class-price-unit">~ ￥</span> <span class="class-price" >{$goods.market_price}</span>-->
                    促销活动简短说明
                </p>
            </div>
        
            <script type="text/javascript" src="//cdn.bootcss.com/jquery.tipsy/1.0.2/jquery.tipsy.js"></script>
 
            <script type="text/javascript">
            $(".feture-item").tipsy({
                gravity: 's',
                fade: true,
                title: function () {
                    return this.getAttribute('data-summary');
                },
                opacity: 1,
                delayIn: 0,
                delayOut: 0
            });
            </script>
             <div class="clearfix detail-panel">
                {foreach from=$specification item=spec key=spec_key}

                <dl>
                    <dt class="_attr-key" data-attr-id="{$spec_key}">{$spec.name}：</dt>
                    {foreach from=$spec.values item=value key=key}
                    <dd class="_property ">
                        <a class="_attr-val" data-value-id="{$value.id}" href="javascript:;">{$value.label}</a>
                    </dd>
                    {/foreach}
                </dl>
                {/foreach}

            </div>
            <div class="btns-box clearfix">
                <a href="javascript:void(0);" class="btnBuy2 htevent" target="_blank" id="makeOrder">立即购买</a>
                <a target="_blank" href="http://www10.53kf.com/webCompany.php?arg=10069074&style=1&keyword=&kf=" class="btnConsult htevent">课程咨询</a>
            </div>
        </div>
    </div>
    <div class="good-detail clearfix">
      <p>
        <img src="/images/pc/detail_02.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_03.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_04.jpg" alt="" title="">
      </p>
       <p>
        <img src="/images/pc/detail_05.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_06.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_07.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_08.jpg" alt="" title="">
      </p>
      <p>
        <img src="/images/pc/detail_09.jpg" alt="" title="">
      </p>
   
    </div>
  </div>

    <script>
        $(function(){
            var shop_price={$goods.shop_price};
            if('{$goods_attrs}'!='')
            {
                var item_attrs=$.parseJSON( '{$goods_attrs}');
            }else{
                var item_attrs={};
            }
        console.info(item_attrs);
            $('._attr-val' ).each(function(){

                for(var i in item_attrs)
                {
                    if(item_attrs[i]==$(this ).attr('data-value-id'))
                    {
                        $(this ).parents('._property ' ).addClass('active')
                    }
                }
                var attr_id=$(this ).parents('._property' ).siblings('._attr-key' ).attr('data-attr-id');
                if(item_attrs[attr_id]&&$(this ).text()=='上纽大直通车'&&$(this ).parents('._property' ).hasClass('active'))
                {
                    $('._property' ).each(function(){

                        if($(this ).find('a' ).text()=='高三'){
                            var _temp_attr_id=$(this ).siblings('._attr-key').attr('data-attr-id');
                            console.info(_temp_attr_id);
                            delete item_attrs[_temp_attr_id];
                            $(this ).removeClass('active').hide();
                        }
                    })
                }
            })
            $("._property" ).click(function(){
                var attr_id=$(this ).siblings('._attr-key').attr('data-attr-id');
                var val_id=$(this ).find('a' ).attr('data-value-id');
                item_attrs[attr_id]=val_id;
                if($(this ).hasClass('active')){
                    delete item_attrs[attr_id];
                    $(this).removeClass('active');
                }else{
                    $(this ).addClass('active' ).siblings('dd' ).removeClass('active');
                }
                if($(this ).find('a' ).text()=='上纽大直通车'&&$(this ).hasClass('active'))
                {
                    $('._property' ).each(function(){

                        if($(this ).find('a' ).text()=='高三'){
                            var _temp_attr_id=$(this ).siblings('._attr-key').attr('data-attr-id');
                            console.info(_temp_attr_id);
                            delete item_attrs[_temp_attr_id];
                            $(this ).removeClass('active').hide();
                        }
                    })
                }else{
                    $('._property' ).each(function(){
                        $(this ).show();
                    })
                }
                console.info(item_attrs);
                selectAttr();
            })
            function selectAttr()
            {
                $.post('?act=add_goods_attr',{goods_id:{$smarty.get.id},item_attrs:item_attrs},function(data){
                    console.info(data);
                })
            }

            $("#makeOrder" ).click(function(){
                var goods_id='{$smarty.get.id}';
                $.post('user.php?act=add_order',{goods_id:goods_id},function(data){
                    console.info(data);
                    //return ;
                    if(data.status=='false'&&data.type=='no_login')
                    {
                        return login();
                    }
                    var order_id=data.data;
                    window.location.href='user.php?act=confirm_order&goods_id='+goods_id;
                },'json');
            })
        })
    </script>


</div>

{include file="foot.html"}
</body>
</html>